#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>

int main(){
	printf("begin\n");
	pid_t pid= fork();
	if(pid==-1)return -1;
	if(pid==0){
		printf("1: %d %d\n",getpid(),getppid());
	}else{
		pid_t pid1=fork();
		if(pid1==-1)return -1;
		sleep(1);
		if(pid1==0){
			printf("2: %d %d\n",getpid(),getppid());	
		}else{
			printf("%d %d\n",getpid(),getppid());	
		}
	}
	return 0;
}
